Apply account creation blocks to users (bug 13611)
authorAaron Schulz <aaron@users.mediawiki.org>
Mon, 22 Sep 2008 13:21:53 +0000 (13:21 +0000)
committerAaron Schulz <aaron@users.mediawiki.org>
Mon, 22 Sep 2008 13:21:53 +0000 (13:21 +0000)
includes/Block.php
includes/User.php

index d2a221f..9e12f33 100644 (file)
@@ -79,7 +79,7 @@ class Block {
                $dbr = wfGetDB( DB_SLAVE );
                $res = $dbr->resultObject( $dbr->select( 'ipblocks', '*',
                        array( 'ipb_id' => $id ), __METHOD__ ) );
-               $block = new Block;
+               $block = new Block();
                if ( $block->loadFromResult( $res ) ) {
                        return $block;
                } else {
@@ -161,7 +161,9 @@ class Block {
                                if ( $user && $this->mAnonOnly ) {
                                        # Block is marked anon-only
                                        # Whitelist this IP address against autoblocks and range blocks
-                                       $this->clear();
+                                       if( !$this->mCreateAccount ) {
+                                               $this->clear(); // bug 13611 - keep this data
+                                       }
                                        return false;
                                } else {
                                        return true;
@@ -172,7 +174,9 @@ class Block {
                # Try range block
                if ( $this->loadRange( $address, $killExpired, $user ) ) {
                        if ( $user && $this->mAnonOnly ) {
-                               $this->clear();
+                               if( !$this->mCreateAccount ) {
+                                       $this->clear(); // bug 13611 - keep this data
+                               }
                                return false;
                        } else {
                                return true;
index 5661c01..d0f41b5 100644 (file)
@@ -1053,8 +1053,10 @@ class User {
                                $this->spreadBlock();
                        }
                } else {
-                       $this->mBlock = null;
-                       wfDebug( __METHOD__.": No block.\n" );
+                       // Bug 13611, apply account creation blocks to users.
+                       // Note that the existence of $this->mBlock is not used
+                       // to check for edit blocks, $this->mBlockedby is instead.
+                       # $this->mBlock = null;
                }
 
                # Proxy blocking